package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.query.TravelQuery;
import cn.wolfcode.wolf2w.service.ITravelService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("travel")
public class TravelController {
        @Autowired
        private ITravelService travelService;

    @RequestMapping("list")
    public String list(Model model,TravelQuery qo){
        model.addAttribute("page",travelService.list(qo));
        return "travel/list";
    }
    @RequestMapping("changeState")
    @ResponseBody
    public Object list(String id,int state){
        return JsonResult.success(travelService.changeState(id,state));
    }
    @RequestMapping("getContentById")
    @ResponseBody
    public Object getContentById(String id){
        return JsonResult.success(travelService.getContentById(id).getContent());
    }

}
